<template>
  <div class="list-table">
    <div class="area-header">
      <span class="area-header-title">{{ $t('投资进度') }}</span>
    </div>
    <el-form ref="queryForm" :model="queryParams" :inline="true" @submit.native.prevent>
      <el-form-item :label="$t('子基金名称')">
        <el-input v-model="queryParams.dealName" clearable @keyup.enter.native="queryHandle" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="queryHandle">{{ $t('搜索') }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" tooltip-effect="darkTable" :data="bfInvestmentProgressList" border>
      <el-table-column :label="$t('序号')" type="index" align="center" show-overflow-tooltip width="50">
        <template slot-scope="scope">
          {{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('投资主体名称')" align="center" prop="investmentName" min-width="200" />
      <el-table-column :label="$t('子基金名称')" align="center" prop="fundName" min-width="200">
        <template slot-scope="scope">
          <router-link
            target="_blank"
            :to="{path:'/deal/home/dealBaseHome', query:{ id:scope.row.dealId }}"
            class="link_a"
          >
            {{ $t(scope.row.fundName) }}
          </router-link>
        </template>
      </el-table-column>
      <el-table-column :label="$t('管理公司')" align="center" prop="managementCompany" min-width="200" />
      <el-table-column :label="$t('总认缴规模') + $t('金额单位')" align="center" prop="totalSubscribedCapital" min-width="130">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.totalSubscribedCapital, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('总实缴规模') + $t('金额单位')" align="center" prop="totalActualCapital" min-width="130">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.totalActualCapital, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('累计投资金额') + $t('金额单位')" align="center" prop="totalInvestmentAmount" min-width="130">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.totalInvestmentAmount, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('总回款金额') + $t('金额单位')" align="center" prop="totalReturnAmount" min-width="130">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.totalReturnAmount, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('已退出成本') + $t('金额单位')" align="center" prop="totalCost" min-width="130">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.totalCost, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('退出进度')" align="center" prop="exitProgress" min-width="130">
        <template slot-scope="scope">
          {{ scope.row.exitProgress }}%
        </template>
      </el-table-column>
      <el-table-column :label="$t('项目最新总估值') + $t('金额单位')" align="center" prop="projectLatestTotalValue" min-width="130">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.projectLatestTotalValue, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('基金成立日')" align="center" prop="fundEstablishmentDate" min-width="130">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.fundEstablishmentDate) }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('基金期限')" align="center" prop="fundTerm" min-width="100" />
      <el-table-column :label="$t('基金阶段')" align="center" prop="fundStage" min-width="100" />
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { getInvestmentProgress } from '@/api/bf/bfInvestmentProgress/bfInvestmentProgress'

export default {
  data() {
    return {
      // 遮罩层
      loading: false,
      // 总条数
      total: 0,
      bfInvestmentProgressList: [],
      // 查询参数
      queryParams: {
        dealName: undefined,
        pageNum: 1,
        pageSize: 10
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.loading = true
      getInvestmentProgress(this.queryParams).then(res => {
        this.loading = false
        this.bfInvestmentProgressList = res.rows
        this.total = res.total
      })
    },
    /** 搜索按钮操作 */
    queryHandle() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.dealName = undefined
      this.queryParams.pageNum = 1
      this.queryParams.pageSize = 10
      this.resetForm('queryForm')
      this.queryHandle()
    }
  }
}
</script>

<style scoped>

</style>
